import * as React from "react";
const { useState } = React;

const App = () => {
  const [count, setCount] = useState(0);

  React.useEffect(() => {
    console.log('挂载回调')
    // debugger
    return () => {
        // debugger
        console.log('销毁回调')
    }
  }, [count])
  return (
    <div>
      <h1>{count}</h1>
      <p>1</p>
      <p>2</p>
      <button onClick={() => setCount(count + 1)}>+1</button>
    </div>
  );
};

export default App;
